
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp" %>

<script>

    function page(n,s){
        $("#pageNo").val(n);
        $("#pageSize").val(s);
        $("#searchForm").submit();
        return false;
    }

</script>
<div class="panel-body">
    <div class="table-responsive no-border">
        <div class="datatable-top">
            <div class="pull-left">
                <form:form id="searchForm" modelAttribute="patPrepayment"
                           onsubmit="return loadDivForm('mainCenterDiv','searchForm','${ctx}/finance/patPrepayment/depositAmountIndex');"
                           method="post" class="form-inline">
                    <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
                    <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
                    <label>收据号 ：</label><form:input path="rcptNo" htmlEscape="false" maxlength="50"
                                                    class="form-control"/> &nbsp;
                    <label>住院号 ：</label><form:input path="visitNo" htmlEscape="false" maxlength="50"
                                                     class="form-control"/> &nbsp;
                    <label>姓名 ：</label><form:input path="name" htmlEscape="false" maxlength="50"
                                                     class="form-control"/> &nbsp;


                    <input class="btn btn-primary" type="submit" value="查询"/>
                </form:form>
            </div>
        </div>
        <table id="contentTable" class="table table-bordered mg-t datatable">
            <thead>
            <tr>
                <th>编号</th>
                <th>收据号</th>
                <th>住院号</th>
                <th>姓名</th>
                <%--<th>身份证号</th>--%>
                <th>支付方式</th>
                <th>支付金额</th>
               <%-- <th>建议预交金</th>--%>
                <th>类型</th>
                <th>缴费日期</th>

                <th>收款员</th>
                <th>退款员</th>
                <th>操作</th>
                <%--<th>退款号</th>--%>
            </tr>
            </thead>
            <tbody>
            <c:forEach items="${page.list}" var="patPrepayment" varStatus="coun">
                <tr style="cursor: pointer" onclick="searchLeft('${patPrepayment.id}','${patPrepayment.patVisitIndex.visitId}','${patPrepayment.patVisitIndex.name}','${patPrepayment.patVisit.visitNo}','${patPrepayment.patVisit.patientId}','${patPrepayment.patVisitIndex.paymentAdvice}')">
                    <td> ${coun.count} </td>
                    <td> ${patPrepayment.rcptNo} </td>
                    <td> ${patPrepayment.patVisit.visitNo} </td>
                    <td> ${patPrepayment.patVisitIndex.name} </td>
                    <%--<td> ${patPrepayment.patVisitIndex.idNo} </td>--%>
                    <td> ${fns:getDictLabel(patPrepayment.payWay,"PAY_WAY_DICT" ,"" )} </td>
                    <td><fmt:formatNumber value="${patPrepayment.amount}" pattern="0.00" maxFractionDigits="2"></fmt:formatNumber></td>
                  <%--  <td>${patPrepayment.patVisitIndex.paymentAdvice}</td>--%>
                    <c:choose>
                        <c:when test="${patPrepayment.type==4}">
                            <td>退款</td>
                        </c:when>
                        <c:when test="${patPrepayment.type==1}">
                            <td>收款</td>
                        </c:when>
                        <c:when test="${patPrepayment.type==3}">
                            <td>结算</td>
                        </c:when>
                        <c:when test="${patPrepayment.type==2}">
                            <td> 作废</td>
                        </c:when>
                        <c:when test="${ patPrepayment.acctNo!= null}">
                            <td> 结账</td>
                        </c:when>
                        <c:otherwise>
                            <td></td>
                        </c:otherwise>
                    </c:choose>
                        <td><fmt:formatDate value="${patPrepayment.createDate}" pattern="yyyy-MM-dd"/></td>

                        <td>${patPrepayment.name}</td>
                        <td>${patPrepayment.refundedUser}</td>
                    <c:choose>
                        <c:when test="${patPrepayment.type eq '1' && patPrepayment.acctNo ==null && patPrepayment.amount!=null && (patPrepayment.createBy.id eq user.id)}">
                            <td>
                                <a href="#" class="applyBt btn btn-danger btn-xs"
                                   onclick="confirmExtend('确认要作废吗？',function(){delLoad('mainCenterDiv','${ctx}/finance/patPrepayment/deletePatPre?id=${patPrepayment.id}','${ctx}/finance/patPrepayment/depositAmountIndex')})">作废</a>
                            </td>
                        </c:when>
                        <%--已收款 type=‘1’ 且退款人为null 且是已结账的预交金acct_no！=null--%>
                        <c:when test="${patPrepayment.type eq '1' && patPrepayment.refundedUser ==null && patPrepayment.acctNo !=null && patPrepayment.amount!=null && (patPrepayment.createBy.id eq user.id)}">
                            <td>
                                <a href="#" class="applyBt btn btn-danger btn-xs"
                                   onclick="confirmExtend('是否要退款${patPrepayment.amount}--${ patPrepayment.rcptNo}该记录？',function(){delLoad('mainCenterDiv','${ctx}/finance/patPrepayment/returnPatPre?id=${patPrepayment.id}','${ctx}/finance/patPrepayment/depositAmountIndex')})">退款</a>
                            </td>
                        </c:when>
                        <c:otherwise>
                            <td></td>
                        </c:otherwise>
                    </c:choose>
                </tr>
            </c:forEach>
            </tbody>
        </table>
        <div class="pagination">${page}</div>
    </div>
</div>